package com.jeesite.modules;

/**
 * Created by chensk on 2018/4/15.
 */

import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Font;
import com.itextpdf.text.FontProvider;
import com.itextpdf.text.pdf.BaseFont;

/**支持中文*/
public final class ChinaFontProvide1 implements FontProvider {

    @Override
    public Font getFont(final String fontname, final String encoding, final boolean embedded, final float size, final int style, final BaseColor color) {


        BaseFont bf = null;

        try {
            bf = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
        } catch (Exception e) {
            e.printStackTrace();
        }
        Font font = new Font(bf, size, style, color);
        font.setColor(color);
        return font;

    }

    @Override
    public boolean isRegistered(String arg0) {
        return false;
    }
}